using Assets.Scripts.GDK;
using DG.Tweening;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;


namespace Brick
{
	[RequireComponent(typeof(Button))]
	public class gdk_button : gdk_base_UI, IPointerEnterHandler, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler, IEventSystemHandler
	{
		public override void OnLoad()
		{
			gdk_game_manager.AddEventListener<bool>("GDK_BUTTON_ENABLED", setButtonEnabled);
		}

		public override void UnLoad()
		{
			gdk_game_manager.RemoveEventListener<bool>("GDK_BUTTON_ENABLED", setButtonEnabled);
		}

		private void setButtonEnabled(bool isEnabled)
		{
			UnityEngine.Debug.Log("gdk_button setButtonEnabled" + isEnabled + base.gameObject.name);
			Button component = base.gameObject.GetComponent<Button>();
			component.enabled = isEnabled;
		}

		void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
		{
			base.gameObject.transform.DOScale(1.2f, 0.2f).SetEase(Ease.Unset).OnComplete(delegate
			{
			});
		}

		void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)
		{
		}

		void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
		{
		}

		void IPointerUpHandler.OnPointerUp(PointerEventData eventData)
		{
			base.gameObject.transform.DOScale(1f, 0.2f).SetEase(Ease.Unset).OnComplete(delegate
			{
			});
		}
	}
}

